package broadcastreceiver;

import android.app.DownloadManager;
import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;

import java.util.Objects;

import mytools.MyBaseActivity;

/**
 * Created by Monkey on 2017/10/24.
 * 下载完成接收器
 */
public class DownLoadReceiver extends BroadcastReceiver {
    @Override
    public void onReceive(Context context, Intent intent) {
        if (Objects.equals(intent.getAction(), DownloadManager.ACTION_DOWNLOAD_COMPLETE)) {
            ((MyBaseActivity) context).cancelProgressDialog();
            Intent broadIntent = new Intent("toUpdateService");
            broadIntent.putExtra("toservice", 0x13);
            context.sendBroadcast(broadIntent);//发送安装通知
        }
    }
}